package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.Pet;
import com.itheima.pojo.PetQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdminPetMapper {
    Page<Pet> list(PetQueryParam petQueryParam);

    @Select("select * from pet")
    List<Pet> findAll(Integer id);

    void deleteById(Integer id);

    @Insert("insert into pet (img,weight,name,gender,age,store_id,species,entry_date,create_time,update_time,desc_id) \n" +
            "VALUES (#{img},#{weight},#{name},#{gender},#{age},#{storeId},#{species},#{entryDate},#{createTime},#{updateTime},#{descId})")
    void addPet(Pet pet);

    @Select("select * from pet where id = #{id}")
    Pet selectId(Integer id);

    void updateById(Pet pet);
}
